<?php

namespace api\modules\v1\models;

use Yii;
use api\common\models\Common;
use api\common\controllers\CommonController;
class Authentication extends Common
{
    /**
     * @return array|string
     */
    public static function tableName()
    {
        return '{{%user_authentication}}';
    }

    public function rules()
    {
        return [
            [['userid', 'real_name','phone','email'],'required'],
            [['userid','phone'], 'integer'],
            ['real_name', 'string','min'=>1, 'max' => 10],
            ['phone', 'string', 'min'=>10,'max' => 11],
            [['phone'],'match','pattern'=>"/^1[34578]{1}\d{9}$/"],
            [['email'],'email',],
            ['notes', 'string', 'max' => 200],
        ];
    }

    public function attributeLabels()
    {
        return [
            'userid' => Yii::t('app', '用户ID'),
            'phone' => Yii::t('app', '手机号码'),
            'real_name' => Yii::t('app', '姓名'),
            'email' => Yii::t('app', '邮箱'),
            'notes' => Yii::t('app', '备注'),
        ];
    }
}
